import 'package:app_admin/models/order_set_info.dart';
import 'package:app_admin/routes/app_pages.dart';

import 'package:get/get.dart';

class AppNavigator {
  AppNavigator._();

  static void startLogin() {
    Get.offAllNamed(AppRoutes.login);
  }

  static void startBackLogin() {
    Get.until((route) => Get.currentRoute == AppRoutes.login);
  }

  static void startSplashToMain({bool isAutoLogin = false}) {
    Get.offAndToNamed(
      AppRoutes.home,
      arguments: {'isAutoLogin': isAutoLogin},
    );
  }

  static void startMain({bool isAutoLogin = false}) {
    Get.offAllNamed(
      AppRoutes.home,
      arguments: {'isAutoLogin': isAutoLogin},
    );
  }

  //====订单设置
  static startOrderSet() => Get.toNamed(AppRoutes.orderSet);
  static startOrderSetAdd() => Get.toNamed(AppRoutes.orderSetAdd);
  static editorOrderSetAdd(OrderSetInfo info) =>
      Get.toNamed(AppRoutes.orderSetAdd, arguments: info);

  //====外销订单
  static startOrderPlan() => Get.toNamed(AppRoutes.orderSetPlan);
  static startOrderPlanAdd() => Get.toNamed(AppRoutes.orderSetPlanAdd);

  static startSelect(String str) =>
      Get.toNamed(AppRoutes.select, arguments: {'strs': str});
}
